#include "SMyListView.h"

void SMyListView::Construct(const FArguments& InArgs){
	FArguments Arguments = InArgs;

	ListItemDatas.Add(MakeShareable(NewObject<UListViewItemData>()));
	ListItemDatas.Add(MakeShareable(NewObject<UListViewItemData>()));
	ListItemDatas.Add(MakeShareable(NewObject<UListViewItemData>()));
	
	Arguments.ListItemsSource(&ListItemDatas);

	Arguments.OnGenerateRow_Raw(this, &SMyListView::GenerateRowItem);
	
	SListView::Construct(Arguments);
}

TSharedRef<ITableRow> SMyListView::GenerateRowItem(TSharedPtr<UListViewItemData> InData, const TSharedRef<STableViewBase>& OwnerTable){
	return SNew(STableRow<TSharedPtr<UListViewItemData>>, OwnerTable)[
		SNew(STextBlock).Text(FText::FromString(InData->MyName))
	];
}
